import { default as request, cloud } from '@/framework/utils/request'

// 服务管理
// 分页查询接口服务管理所有数据
export function pageApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/page',
    method: 'get',
    params: query
  })
}

// 接口服务管理所有数据树列表
export function getSystemTreeApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/getSystemTree',
    method: 'get',
    params: query
  })
}

// 新增接口服务管理数据
export function addApi(query, isAdd) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/' + (isAdd ? 'edit' : 'add'),
    method: 'post',
    data: query
  })
}

// 获取可用系统列表
export function getSystemListApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/getSystemList',
    method: 'get',
    params: query
  })
}

// 获取前置接口列表
export function getInterfaceBeforeListApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/getInterfaceBeforeList',
    method: 'get',
    params: query
  })
}

// 接口联通测试
export function pingApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/ping',
    method: 'post',
    data: query
  })
}

// 删除
export function deleteApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/delete',
    method: 'post',
    data: query
  })
}

// 禁用前校验是否已经有接口在使用
export function isUsedApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/isUsed',
    method: 'post',
    data: query
  })
}
// 启用/禁用
export function updateStsApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/updateSts',
    method: 'post',
    data: query
  })
}

// 修改顶层字段是否为集合
export function updateTopIsList(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/updateTopIsList',
    method: 'post',
    data: query
  })
}

// 接口字段维护
// 分页查询接口字段维护所有数据
export function fieldPageApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceFieldDetail/page',
    method: 'get',
    params: query
  })
}

// 查询接口字段维护所有数据(懒加载)
export function fieldTreeListApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceFieldDetail/list',
    method: 'get',
    params: query
  })
}

// 新增接口字段维护数据
export function fieldAddApi(query, isAdd) {
  return request({
    url: cloud.interfacePlatform + '/interfaceFieldDetail/' + (isAdd ? 'edit' : 'add'),
    method: 'post',
    data: query
  })
}

// 删除接口字段维护数据
export function fieldDeleteApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceFieldDetail/delete',
    method: 'post',
    data: query
  })
}

// 修改发布状态
export function updateUpStatusApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/updateUpStatus',
    method: 'post',
    data: query
  })
}

// 获取提供方发布审核列表
export function getUpCheckListApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/getUpCheckList',
    method: 'get',
    params: query
  })
}

// 接口加解密方式
// 新增接口加解密方式数据
export function EAndDAddApi(query, isAdd) {
  return request({
    url: cloud.interfacePlatform + '/interfaceEncryptDecryptInfo/' + (isAdd ? 'edit' : 'add'),
    method: 'post',
    data: query
  })
}

// 获取接口加解密方式单条数据详情
export function EAndDDetailApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceEncryptDecryptInfo/detail',
    method: 'get',
    params: query
  })
}

// 删除接口加解密方式数据
export function EAndDDeleteApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceEncryptDecryptInfo/delete',
    method: 'post',
    data: query
  })
}

// 预下线
export function preOfflineApi(query) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceManager/preOffline',
    method: 'post',
    data: query
  })
}

